package com.hdd.hll.modules.info.web;

import com.hdd.hll.common.response.Response;
import com.hdd.hll.common.response.ResponseUtils;
import com.hdd.hll.modules.info.bean.Coal;
import com.hdd.hll.modules.info.bean.CoalCompanys;
import com.hdd.hll.modules.info.bean.Company;
import com.hdd.hll.modules.info.service.InformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping(value = "/coalCompanys")
@Slf4j
@Api(value="对照表数据",tags={"对照表数据"})
public class InformationController {

    @Autowired
    InformationService informationService;

    @ApiOperation(value="煤种，供货商，收货商信息", notes="注意别出错" ,httpMethod="GET")
    @RequestMapping(value="/findAll", method= RequestMethod.GET)
    public Response<CoalCompanys> findAll()throws InterruptedException{
        CoalCompanys coalCompanys = informationService.findAll();
        return ResponseUtils.inits(coalCompanys);
    }

    @ApiOperation(value="煤种信息", notes="注意别出错" ,httpMethod="GET")
    @RequestMapping(value="/findCoals", method= RequestMethod.GET)
    public Response<List<Coal>> findCoals()throws InterruptedException{
        List<Coal> coals = informationService.findCoals();
        return ResponseUtils.inits(coals);
    }

    @ApiOperation(value="收货单位信息", notes="注意别出错" ,httpMethod="GET")
    @RequestMapping(value="/findCollect", method= RequestMethod.GET)
    public Response<List<Company>> findCollect()throws InterruptedException{
        List<Company> collectors = informationService.findCollects();
        return ResponseUtils.inits(collectors);
    }

    @ApiOperation(value="供货单位信息", notes="注意别出错" ,httpMethod="GET")
    @RequestMapping(value="/findProvides", method= RequestMethod.GET)
    public Response<List<Company>> findProvides()throws InterruptedException{
        List<Company> provides = informationService.findProvides();
        return ResponseUtils.inits(provides);
    }
}
